# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=kdiskmark
pkgver=3.1.4
pkgrel=1
pkgdesc="Simple open-source disk benchmark tool for Linux distros"
url="https://github.com/JonMagon/KDiskMark"
arch="all"
license="GPL-3.0-or-later"
depends="fio"
makedepends="
	cmake
	extra-cmake-modules
	polkit-qt-dev
	qt5-qtbase-dev
	qt5-qttools-dev
	samurai
	"
langdir="/usr/share/kdiskmark/kdiskmark/translations"
subpackages="$pkgname-lang"
source="https://github.com/JonMagon/KDiskMark/releases/download/$pkgver/KDiskMark-$pkgver-source.tar.gz"
builddir="$srcdir/KDiskMark-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
53f292e4137ac36dfbc09ad400496170bfd13a8c18f1c474bd15b00cdd931918713e034e35d6f3dbda29eb1ee89d8f273dd8e794a9e70c95ec96ebf31f0baedf  KDiskMark-3.1.4-source.tar.gz
"
